package com.woniuxy.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.woniuxy.entity.Warehouse;

@Mapper
public interface WarehouseMapper {
	//查询所有仓库
	@Select("select * from t_warehouse")
	public List<Warehouse> findAllWarehouse();
	
	//根据状态查询仓库
	@Select("select * from t_warehouse where status=#{status}")
	public List<Warehouse>findWarehouseByStatus(int status);
	//模糊查询
	@Select("select * from t_warehouse where wname like CONCAT('%',#{words},'%') or wcode like CONCAT('%',#{words},'%')")
	public List<Warehouse>findWarehouseByWords(String words);
	//新建仓库
	@Insert("insert into t_role values(default,#{rname},#{rcode},#{status},#{description},#{ctime})")
	public int insertWarehouse(Warehouse warehouse);
	//删除
	@Delete("delete from t_warehouse where wid=#{wid}")
	public int delByWid(int wid);
}
